# aria2 下载器docker 自用
# 使用的镜像
FROM alpine:3.19

ARG USER_NAME

ENV LANG=en_US.UTF-8 \
    LANGUAGE=en_US.UTF-8

# 换源
RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories &&\
    apk add --no-cache aria2



RUN addgroup $USER_NAME && adduser --disabled-password -G $USER_NAME $USER_NAME
WORKDIR /home/$USER_NAME
USER $USER_NAME
RUN mkdir Downloads .aria2 &&\
    touch .aria2/aria2.log .aria2/aria2.session
# 下载conf文件
RUN wget https://gitee.com/jianghuchuan_kebei/miscellaneous/raw/master/aria2.conf  -O ./.aria2/aria2.conf

EXPOSE 6800

CMD [ "/usr/bin/aria2c" ,"--conf-path=./.aria2/aria2.conf" ]

# 编译命令 docker build  --build-arg USER_NAME=$USER  -t aria2:1.37-alpine . 
# 运行命令 docker run -itd --name aria2 -v ~/Downloads/:/home/anp/Downloads  -p 6800:6800 aria2:1.37-alpine 